{extend name="common/page"}
{block name="content"}
<form class="layui-form" action="">
    <div class="layui-form-item">
        <label class="layui-form-label">权限名</label>
        <div class="layui-input-block">
            <input value="{$privilege.name}" type="text" name="name" required lay-verify="required" placeholder="请输入权限名" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">权限分类</label>
        <div class="layui-input-block">
            <select name="category_id" lay-verify="required" lay-search>
                <option value></option>
                {volist name="categories" id="category"}
                <option value="{$category.id}" {if $category.id == $privilege.category_id}selected{/if}>{$category.name}</option>
                {/volist}
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">模块</label>
        <div class="layui-input-block">
            <input value="{$privilege.m}" type="text" name="m" required lay-verify="required" placeholder="请输入模块" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">控制器</label>
        <div class="layui-input-block">
            <input value="{$privilege.c}" type="text" name="c" required lay-verify="required" placeholder="请输入控制器" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">操作</label>
        <div class="layui-input-block">
            <input value="{$privilege.a}" type="text" name="a" required lay-verify="required" placeholder="请输入操作" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">显示</label>
        <div class="layui-input-block">
            <input type="radio" name="display" value="1" title="是" {if $privilege.display == 1}checked{/if}>
            <input type="radio" name="display" value="2" title="否" {if $privilege.display == 2}checked{/if}>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">排序</label>
        <div class="layui-input-block">
            <input value="{$privilege.list_order}" type="number" name="list_order" required lay-verify="required" placeholder="请输入排序1-999整数，小在前" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">备注</label>
        <div class="layui-input-block">
            <textarea name="note" placeholder="请输入内容" class="layui-textarea">{$privilege.note}</textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="editForm">修改</button>
        </div>
    </div>
</form>
{/block}

{block name="script"}
<script>
    layui.use(['form'], function () {
        $k.submit('editForm', '/privilege/edit/{$privilege.id}', function () {
            $k.reload(parent.tableInst, '/privilege');
            $k.adminClose();
        })
    })
</script>
{/block}